<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>电子发票</title>
    <meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0">
    <meta name="format-detection" content="telephone=no">
    <meta name="format-detection" content="email=no">
    <meta http-equiv="X-UA-Compatible" content="chrome=1" />
    <link href="/res/style/simpleui.min.css?v=${version!}" rel="stylesheet" type="text/css">
    <link href="/res/style/base/vectors.2.css?v=${version!}" rel="stylesheet" type="text/css">
    <link href="/res/style/passenger/e-invoice.css" rel="stylesheet" type="text/css">
</head>
<body>
<header>
    开具电子发票
</header>
<div class="content">
    <div class="item">
        <span class="point">*</span>
        <span class="title">车票号</span>
        <div class="inp"><input id='ticketNo' type="text" placeholder="请填写车票号"></div>
    </div>
    <div class="item">
        <span class="point">*</span>
        <span class="title">手机号</span>
        <div class="inp"><input id="collPhone" type="tel" maxlength="11" placeholder="请填写手机号码"></div>
    </div>
</div>

<div class="warm-prompt">
    <h6>温馨提示：</h6>
    <p>1.车票号、手机号请在订单详情中查看</p>
    <p>2.手机号请用购票时填写的联系人手机号</p>
</div>

    <div class="btn-next">
        下一步
    </div>
</body>
<script src="/js/zepto.min.js"></script>
<script src="/js/simpleui.min.js"></script>
<script src="/config.js"></script>
<script>
    $('.btn-next').on('click',function () {
        var collPhone = $('#collPhone').val();
        var ticketNo = $('#ticketNo').val();

        if("" == ticketNo){
            $.toast('请填写票号');
            return false;
        }

        if("" == collPhone){
            $.toast('请填写手机号');
            return false;
        }

        if(!(/^1\d{10}$/.test(collPhone))){
            $.toast('请填写正确的手机号');
            return false;
        }

        var url =  "/busTicketOrder/getInvoiceLink";
        $.ajax({
            type:'post',
            url:url,
            dataType:'json',
            data:{
                ticketSerialNo:ticketNo,
                mobile:collPhone
            },
            success:function (res) {
                if(res.code == 0){
                    window.location = res.data;
                }else {
                    $.alert(res.message);
                }
            }
        })
    })
</script>
</html>